﻿<UserControl x:Class="DevControlLibrary.UI.DbConnectionControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
             xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
             xmlns:loc="clr-namespace:DevControlLibrary.Common"
             xmlns:Model="clr-namespace:DBAccessLibrary.Model;assembly=DBAccessLibrary" 
             FontSize="12"
             FontFamily="NSimSun"
             TextOptions.TextFormattingMode="Display"
             TextOptions.TextRenderingMode="ClearType">
    <dxlc:LayoutControl Padding="0">
        <dxlc:LayoutGroup View="Tabs" SelectedTabChildChanged="LayoutGroup_SelectedTabChildChanged">
            <dxlc:LayoutGroup Header="常用连接" Orientation="Vertical">
                <dxlc:LayoutItem Label="数  据  源：" HorizontalAlignment="Center">
                    <dxe:ComboBoxEdit Height="23" HorizontalAlignment="Left"  Name="cbType" VerticalAlignment="Top" Width="195" 
                                              loc:EnumSelectorProperty.EnumType="{x:Type Model:DBType}"
                                              loc:EnumSelectorProperty.Filter="Ole|ODBC"
                                              loc:EnumSelectorProperty.BindingPath="DataSource.ConnectType"
                                              Text="{Binding DataSource.ConnectType}" IsTextEditable="False" />
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="服务器地址：" HorizontalAlignment="Center">
                    <dxe:TextEdit Height="23" HorizontalAlignment="Left"  Name="tbIP" VerticalAlignment="Top" Width="195" 
                                Text="{Binding Path=DataSource.Server,Mode=TwoWay}"/>
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="数据库名称：" HorizontalAlignment="Center" Name="TbdbName">
                    <dxe:TextEdit Height="23" HorizontalAlignment="Left"  Name="tbDBName" VerticalAlignment="Top" Width="195" 
                                Text="{Binding Path=DataSource.DataBase,Mode=TwoWay}"/>
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="用  户  名：" HorizontalAlignment="Center">
                    <dxe:TextEdit Height="23" HorizontalAlignment="Left" Name="tbUserID" VerticalAlignment="Top" Width="195" 
                                Text="{Binding DataSource.UserID}"/>
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="密      码：" HorizontalAlignment="Center">
                    <dxe:PasswordBoxEdit Height="23" HorizontalAlignment="Left"  Name="tbPwd" VerticalAlignment="Top" Width="195" 
                                    Password="{Binding DataSource.PassWord,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                </dxlc:LayoutItem>
            </dxlc:LayoutGroup>

            <dxlc:LayoutGroup  Header="Excel" Orientation="Vertical" >
                <dxlc:LayoutItem Label="文     件:" HorizontalAlignment="Center" >
                    <StackPanel Orientation="Horizontal">
                        <dxe:TextEdit Name="TbExcelFileName" Height="23" Width="175" IsReadOnly="True"
                                              Text="{Binding Path=DataSource.DataBase,Mode=TwoWay}"/>
                        <dxe:ButtonEdit ShowText="False" AllowDefaultButton="False" Height="23" Width="30">
                            <dxe:ButtonInfo GlyphKind="Custom" Content="..." ButtonKind="Simple" Click="ButtonExcelFileClick"/>
                        </dxe:ButtonEdit>
                    </StackPanel>
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="连接字符串" HorizontalAlignment="Center">
                    <dxe:TextEdit Name="TbExcelConnectionStr" Height="100" Width="205" TextWrapping="Wrap" HorizontalScrollBarVisibility="Auto" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Auto"
                                          Text="{Binding Path=DataSource.ConnectionStr,Mode=TwoWay}"/>
                </dxlc:LayoutItem>
            </dxlc:LayoutGroup>

            <dxlc:LayoutGroup Header="ODBC" Orientation="Vertical">
                <dxlc:LayoutItem Label="驱      动:" HorizontalAlignment="Center">
                    <dxe:ComboBoxEdit Name="CbOdbcType" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="205" 
                                              Text="{Binding Path=DataSource.DataBase,Mode=TwoWay}" SelectedIndexChanged="CbOdbcType_SelectedIndexChanged" />
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="用  户  名:" HorizontalAlignment="Center">
                    <dxe:TextEdit Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="205" 
                                Text="{Binding DataSource.UserID}" EditValueChanged="OdbcEditValueChanged" />
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="密      码:" HorizontalAlignment="Center">
                    <dxe:PasswordBoxEdit Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="205" 
                                    Password="{Binding DataSource.PassWord,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" EditValueChanged="OdbcEditValueChanged" />
                </dxlc:LayoutItem>
                <dxlc:LayoutItem Label="连接字符串:" HorizontalAlignment="Center">
                    <dxe:TextEdit Name="TbOdbcConnectionStr" Height="54" Width="205" TextWrapping="Wrap" HorizontalScrollBarVisibility="Auto" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Auto"
                                          Text="{Binding Path=DataSource.ConnectionStr,Mode=TwoWay}"/>
                </dxlc:LayoutItem>
            </dxlc:LayoutGroup>
        </dxlc:LayoutGroup>
    </dxlc:LayoutControl>
</UserControl>
